package com.zrc.superframe_base.mvx.mvvm.adpter

import android.widget.ImageView
import androidx.databinding.BindingAdapter
import com.zrc.superframe_base.R
import com.zrc.superframe_base.utils.transformations.GlideLoader

/**
 * @Author: superman
 * @CreateTime: 11/10/21
 * @Describe: 根据xml属性来加载图片
 */
object ImageViewAdapter {
    @BindingAdapter("app:imageUrl")
    @JvmStatic
    fun setSrc(imageView: ImageView?, url: String?) {
        GlideLoader.getInstance().displayRoundImage(url, imageView, R.drawable.vector_image_faild,5)
    }

    @BindingAdapter("android:src")
    @JvmStatic
    fun setSrc(imageView: ImageView, resId: Int) {
        imageView.setImageResource(resId)
    }
}